<template>
  <el-row>
    <el-col :span="12">
      {{msg}}
    </el-col>
    <el-col :span="12">
      <TestSlot>
        <el-col :span="12" slot="hello">
          aaaaaaaa {{testDate()}}
        </el-col>
      </TestSlot>
    </el-col>
  </el-row>
</template>

<script>
import TestSlot from './TestSlot'
import moment from 'moment'

export default {
  components: {
    TestSlot
  },
  data () {
    return {
      msg: 'login',
      isLogin: false
    }
  },
  created: function () {
    // this.test()
    // this.testFilter()
    this.testFind()
  },
  computed: {
  },
  methods: {
    test: function () {
      let ss = [
        {key: 3},
        ...this.test1()
      ]
      console.log(ss.length)

      ss.forEach(v => {
        console.log('value=', v)
      })
    },
    test1: function () {
      return [{key: 1}, {key: 2}]
    },
    testFilter: function () {
      let tmp = [
        {key: 'a', key1: '1'},
        {key: 'b', key1: '2'},
        {key: 'c', key1: '3'},
        {key: 'a', key1: '4'}
      ]
      let r = tmp.filter(v => {
        return v.key === 'a'
      })
      console.log(r)
    },
    testFind: function () {
      let tmp = [
        {key: 'a', key1: '1'},
        {key: 'b', key1: '2'},
        {key: 'c', key1: '3'},
        {key: 'a', key1: '4'}
      ]
      let r = tmp.find(v => v.key === 'a')
      console.log(r)
    },
    testDate: function () {
      console.log('')

      console.log('')
      return moment(1501665896000).format('YYYY-MM-DD HH:mm:ss')
    }
  }
}
</script>

<style scoped>
.el-row {
    margin-top: 10px;
  }
</style>
